package com.qianli.user.facade.query.impl.social;

import com.fqgj.common.api.Response;
import com.qianli.user.application.UserSocialApplication;
import com.qianli.user.facade.query.social.UserSocialQueryServiceFacade;
import com.qianli.user.ro.UserStateCode;
import com.qianli.user.ro.query.UserBaseQueryRO;
import com.qianli.user.ro.social.UserSocialRO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * name:社交信息查询
 * auth:ting.li@qianli-inc.com
 * date:2018/1/9 17:17
 * version: v1.0.0
 **/
@Service("userSocialQueryServiceFacade")
public class UserSocialQueryServiceFacadeImpl implements UserSocialQueryServiceFacade{

    private static final Logger LOGGER = LoggerFactory.getLogger(UserSocialQueryServiceFacade.class);

    @Autowired
    private UserSocialApplication userSocialApplication;

    /**
     * 查询社交信息
     * @param queryRO
     * @return
     */
    @Override
    public Response<UserSocialRO> getUserSocial(UserBaseQueryRO queryRO) {
        if(null == queryRO){
            LOGGER.info("UserSocialQueryServiceFacade.getUserSocial param can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK);
        }
        if(null == queryRO.getAppCode()||null == queryRO.getBiz()){
            LOGGER.info("UserSocialQueryServiceFacade.getUserSocial param appCode and biz  can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"appCode and biz  can not be null");
        }
        if(null == queryRO.getUserCode()){
            LOGGER.info("UserSocialQueryServiceFacade.getUserSocial param userCode  can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"userCode can not be null");
        }
        Response<UserSocialRO> response = userSocialApplication.load(queryRO.getUserCode());
        return response;
    }
}
